package designpattern.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zhangxin
 * @date 2020/10/29
 */
public class MyInvocationHandler implements InvocationHandler {

    private Object target;


    public MyInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("方法执行前");
        Object invoke = method.invoke(target, args);

        // executor.doQuery();
        System.out.println("方法执行后");
        return invoke;
    }
}
